﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.inspecplaninfo
{
    public partial class Modify : Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    int ipid = (Convert.ToInt32(Request.Params["id"]));
                    ShowInfo(ipid);
                }
            }
        }

        private void ShowInfo(int ipid)
        {
            lcs.BLL.inspecplaninfo bll = new lcs.BLL.inspecplaninfo();
            lcs.Model.inspecplaninfo model = bll.GetModel(ipid);
            //this.lblipid.Text = model.ipid.ToString();
            this.txtipname.Text = model.ipname;
            this.txtipdays.Text = model.ipdays.ToString();

        }

        public void btnSave_Click(object sender, EventArgs e)
        {

            if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
            {
                int ipid = (Convert.ToInt32(Request.Params["id"]));
                string ipname = this.txtipname.Text;
                int ipdays = int.Parse(this.txtipdays.Text);
                lcs.Model.inspecplaninfo model = new lcs.Model.inspecplaninfo();
                model.ipid = ipid;
                model.ipname = ipname;
                model.ipdays = ipdays;

                lcs.BLL.inspecplaninfo bll = new lcs.BLL.inspecplaninfo();
                bll.Update(model);
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "list.aspx");
            }

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
